package com.wcw.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wcw.entity.Author;
import com.wcw.entity.Book;
import com.wcw.mapper.AuthorMapper;

@Service
public class AuthorService {

	@Autowired
	private AuthorMapper authorMapper;
	
	public void selectUsers() {
		authorMapper.selectUsers();
	}
	public void selectTest2() {
		authorMapper.selectTest2();
	}
	
	public void aliasesTest() {
		authorMapper.aliasesTest();
	}
	
	public void selectAllUser() {
		List<Author> selectAllUser = authorMapper.selectAllUser();
		System.out.println(selectAllUser.size());
		for(Author a :selectAllUser) {
			System.out.println("-----" +a.toString());
			for(Book b : a.getBooks()) {
				System.out.println("    :" +a.toString());
			}
		}
	}
}
